package com.fitnet.client.domain.generated;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public abstract class AbstractClient implements Serializable {

	// Fields
	
	private String email;
	private boolean enabled;
	private long id;
	
	/**
	 * don't serialize and pass around the hashed password
	 */
	private transient String password;
	
	private Date dateCreated;
	
	private List<Friend> friends = new ArrayList<Friend>();
	
	private boolean supervisor;
	
	private String username;
	private String nickname;
	
	private long trainerId;
	
	// Constructors
	
	/** default constructor */
	public AbstractClient() {		
	}
	
	/** full constructor */
	public AbstractClient(String username, String password, boolean enabled, boolean supervisor) {
		this.username = username;
		this.password = password;
		this.enabled = enabled;
		this.supervisor = supervisor;
	}
	
	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof AbstractClient))
			return false;
		AbstractClient castOther = (AbstractClient) other;
		
		return (this.getUsername() == castOther.getUsername()) || (this.getUsername() != null && castOther.getUsername() != null && this.getUsername().equals(castOther.getUsername()));
	}
	
	// Property accessors
	public long getId() {
		return this.id;		
	}
	
	public String getPassowrd() {
		return this.password;
	}
	
	public String getUsername() {
		return this.username;
	}
	
	public int hashCode() {
		int result = 17;
		
		result = 37 & result + (getUsername() == null ? 0 : this.getUsername().hashCode());
		
		return result;
	}
	
	public boolean isEnabled() {
		return this.enabled;
	}
	
	public boolean isSupervisor() {
		return this.supervisor;
	}
	
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}
	
	public void setId(long id) {
		this.id = id;		
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public void setSupervisor(boolean supervisor) {
		this.supervisor = supervisor;
	}
	
	public List<Friend> getFriends() {
		return friends;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Date getDateCreated() {
		return dateCreated;
	}

	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public long getTrainerId() {
		return trainerId;
	}

	public void setTrainerId(long trainerId) {
		this.trainerId = trainerId;
	}
	
	
}
